<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.min.js"></script>
    <script src="../js/axios.min.js"></script>
</head>

<body>
    <div id="app">
        <input type="button" value="点击获取一个笑话" @click="getJoke">
        <h2>{{joke}}</h2>
    </div>
</body>

<script>
    var VM = new Vue({
        el: '#app',
        data: {
            joke: ''
        },
        methods: {
            getJoke: function() {
                var that = this;
                axios.get("https://autumnfish.cn/api/joke").then(
                    function(response) {
                        that.joke = response.data;
                    },
                    function(error) {

                    })
            }
        }
    })
</script>

</html>